<?php
namespace Admin\Controller;
use Think\Controller;
use Think\Page;
class LogController extends CommonController {
    //登陆日志
    public function login(){
        $log_object = D('log_login');
        $map['status'] = array('egt', '0'); // 禁用和正常状态
        $Page = new Page($log_object->where($map)->count(),C('ADMIN_CONFIG.page_size'));
        $Page->setConfig('prev','«');
        $Page->setConfig('next','»');
        $data_list     = $log_object
            ->where($map)
            ->order('id asc')
            ->limit($Page->firstRow.','.$Page->listRows)
            ->select();
        $this->assign('mark','user');
        $this->assign('umark','log_login');
        A('list')->setMetaTitle('登录日志')
            ->setBreadCrumb(array('用户','用户记录','登录日志'))
            ->addTopButton('delete')
            ->addTableColumn('id','ID','number',50)
            ->addTableColumn('user_id','用户','getuser',80,'false')
            ->addTableColumn('type','登录方式','number',80,'false')
            ->addTableColumn('ip','登录IP','text',120,'false')
            ->addTableColumn('device','登录设备','text','auto','false')
            ->addTableColumn('ctime','创建时间','date',120)
            ->addTableColumn('','操作','rightbtn',80,'false')
            ->setTableDataList($data_list)
            ->setTableDataPage($Page->show())
            ->addRightButton('delete')
            ->fetch();
    }
    //积分记录
    public function score(){
        $log_object = D('log_score');
        $map['status'] = array('egt', '0'); // 禁用和正常状态
        $Page = new Page($log_object->where($map)->count(),C('ADMIN_CONFIG.page_size'));
        $Page->setConfig('prev','«');
        $Page->setConfig('next','»');
        $data_list     = $log_object
            ->where($map)
            ->order('id asc')
            ->limit($Page->firstRow.','.$Page->listRows)
            ->select();
        $this->assign('mark','user');
        $this->assign('umark','log_score');
        A('list')->setMetaTitle('积分记录')
            ->setBreadCrumb(array('用户','用户记录','积分记录'))
            ->addTopButton('delete')
            ->addTableColumn('id','ID','number',50)
            ->addTableColumn('user_id','用户','getuser',80,'false')
            ->addTableColumn('type','变化类型','number',80,'false')
            ->addTableColumn('title','积分名称','text',120,'false')
            ->addTableColumn('value','数值','number',80,'false')
            ->addTableColumn('desc','备注','text','auto','false')
            ->addTableColumn('ctime','创建时间','date',120)
            ->addTableColumn('','操作','rightbtn',80,'false')
            ->setTableDataList($data_list)
            ->setTableDataPage($Page->show())
            ->addRightButton('delete')
            ->fetch();
    }
    //提现记录
    public function withdraw(){
        $log_object = D('withdraw');
        $map['status'] = array('egt', '0'); // 禁用和正常状态
        $Page = new Page($log_object->where($map)->count(),C('ADMIN_CONFIG.page_size'));
        $Page->setConfig('prev','«');
        $Page->setConfig('next','»');
        $data_list     = $log_object
            ->where($map)
            ->order('id asc')
            ->limit($Page->firstRow.','.$Page->listRows)
            ->select();
        $this->assign('mark','user');
        $this->assign('umark','withdraw');
        A('list')->setMetaTitle('提现记录')
            ->setBreadCrumb(array('用户','钱包操作','提现记录'))
            ->addTopButton('delete')
            ->addTableColumn('id','ID','number',50)
            ->addTableColumn('user_id','用户','getuser',80,'false')
            ->addTableColumn('type','提现类型','withdrawtype',80,'false')
            ->addTableColumn('value','提现金额（元）','text',120,'false')
            ->addTableColumn('auditing','审核','status1',60)
            ->addTableColumn('atime','审核时间','date',120)
            ->addTableColumn('desc','审核备注','text','auto','false')
            ->addTableColumn('ctime','创建时间','date',120)
            ->addTableColumn('','操作','rightbtn',140,'false')
            ->setTableDataList($data_list)
            ->setTableDataPage($Page->show())
            ->addRightButton('custom',array('title'=>'<i class="icon icon-print"></i> 审核','class'=>'btn btn-xs btn-warning btn-review','href'=>U('pay/review',array('id'=>'__dataid__'))))
            ->addRightButton('delete')
            ->fetch();
    }
}
